﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowPublicHolidays.aspx.cs"
    Inherits="Actuals.ShowPublicHolidays" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head1" runat="server">
    <base target="_self" />
    <link href="~/Actuals.css" rel="stylesheet" type="text/css" />
    <link href="~/themes/ui-lightness/jquery.ui.all.css" rel="stylesheet" type="text/css" />
    <title>PublicHolidays</title>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.datepicker.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.core.js") %>"></script>
    <script type="text/javascript">
        /*  $(document).ready(function () {
        $("#<%=txtYear.ClientID%>").datepicker({ dateFormat: 'yy',

        changeYear: true,
        yearRange: '2011:2015',
        onClose: function (dateText) {
        var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
        $(this).datepicker('setDate', new Date(year));
        }
        });

        });*/

        function ShowAddPublicHolidays() {


            var url = 'AddPublicHolidays.aspx?Mode=Add';
            var result = window.showModalDialog(url, this, 'dialogHeight:400px;dialogWidth:400px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }

        function ShowUpdatePublicHolidays(id) {
            var url = 'AddPublicHolidays.aspx?Mode=Edit&Id=' + id;
            var result = window.showModalDialog(url, this, 'dialogHeight:400px;dialogWidth:400px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }


        function TestCheckBox() {
            debugger;
            var Target = null;
            Target = document.getElementById('<% = this.gvResults.ClientID %>');
            if (Target == null) {
                alert("No record is selected.Please select!");
                return false;
            }
            var Inputs = Target.getElementsByTagName("input");
            for (var n = 0; n < Inputs.length; ++n) {
                if (Inputs[n].type == 'checkbox' && Inputs[n].checked) {
                    return confirm("Do you want to Delete?");
                }
            }
            
            alert("No record is selected.Please select!");
            return false;


        }

     
  
    </script>
    <!-- <style type="text/css">
        .ui-datepicker-calendar
        {
            display: none;
        }
        .ui-datepicker-month
        {
            display:none;
        }
       
    </style> -->
</head>
<body>
    <form id="form1" runat="server">
    <center>
        <div id="divPublicHolidays" runat="server">
            <asp:Label ID="lblMsg" runat="server" CssClass="message">
            </asp:Label>
            <table>
                <tr>
                    <td>
                        <asp:Label ID="lblYear" runat="server" CssClass="label">Year</asp:Label>
                    </td>
                    <td class="LabelRequiredField">
                        <!-- <asp:TextBox ID="txtYear" runat="server" CssClass="textfield"></asp:TextBox>-->
                        <asp:DropDownList ID="ddlYear" runat="server" CssClass="textfield">
                            <asp:ListItem Value="0">Select</asp:ListItem>
                            <asp:ListItem Value="2011">2011</asp:ListItem>
                            <asp:ListItem Value="2012">2012</asp:ListItem>
                            <asp:ListItem Value="2013">2013</asp:ListItem>
                        </asp:DropDownList>
                        * (yyyy)
                        <asp:RequiredFieldValidator ID="rfvYear" ControlToValidate="txtYear" runat="server"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="btnGetPublicHolidays" runat="server" Text="GetPublicHolidays" OnClick="btnGetPublicHolidays_Click" />
                    </td>
                </tr>
            </table>
        </div>
        <div runat="server" id="divControls">
            <div id="divGrid" style="border: solid 1px silver; height: 520px; text-align: center;
                overflow-x: hidden; overflow-y: auto;">
                <asp:GridView ID="gvResults" AutoGenerateColumns="false" BorderColor="Black" runat="server"
                    OnRowCommand="gvResults_OnRowCommand">
                    <HeaderStyle BackColor="White" Font-Size="10px" ForeColor="#990000" BorderStyle="None" />
                    <RowStyle BackColor="#F7F3F7" Font-Names="Verdana" Font-Size="XX-Small" BorderStyle="None" />
                    <AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="XX-Small"
                        BorderStyle="None" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:CheckBox runat="server" ID="chkShowPublicHolidays" AutoPostBack="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblId" runat="server" Text='<%# Bind("Id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="HolidayDate">
                            <ItemTemplate>
                                <asp:Label ID="lblHolidayDate" runat="server" Text='<%# Bind("HolidayDate") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Description">
                            <ItemTemplate>
                                <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("Description") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="EditPublicHolidays"
                                    CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Id") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>
        <asp:Button ID="btnDelete" runat="server" CssClass="button" Text="Delete" OnClick="btn_DeletePublicHolidays" OnClientClick = "return TestCheckBox()"/>
        <div>
            <asp:Button ID="btnAddPublicHolidays" runat="server" Text="AddPublicHolidays" CssClass="button"
                OnClientClick="return ShowAddPublicHolidays()" />
        </div>
    </center>
    </form>
</body>
</html>
